<!doctype html>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<script src="../../assert_selection.js"></script>
<script>
if (window.internals)
  internals.settings.setEditingBehavior('win');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">|    אבצ    abc    דעפ     </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    |\u05D0\u05D1\u05E6    abc    \u05D3\u05E2\u05E4     </div>',
  '40-0 left word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre"> |   אבצ    abc    דעפ     </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    |\u05D0\u05D1\u05E6    abc    \u05D3\u05E2\u05E4     </div>',
  '40-1 left word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">  |  אבצ    abc    דעפ     </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    |\u05D0\u05D1\u05E6    abc    \u05D3\u05E2\u05E4     </div>',
  '40-2 left word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">   | אבצ    abc    דעפ     </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    |\u05D0\u05D1\u05E6    abc    \u05D3\u05E2\u05E4     </div>',
  '40-3 left word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    |אבצ    abc    דעפ     </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ    |abc    דעפ     </div>',
  '40-4 left word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    א|בצ    abc    דעפ     </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ    |abc    דעפ     </div>',
  '40-5 left word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    אב|צ    abc    דעפ     </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ    |abc    דעפ     </div>',
  '40-6 left word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ|    abc    דעפ     </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    \u05D0\u05D1\u05E6    |abc    \u05D3\u05E2\u05E4     </div>',
  '40-7 left word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ |   abc    דעפ     </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    \u05D0\u05D1\u05E6    |abc    \u05D3\u05E2\u05E4     </div>',
  '40-8 left word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ  |  abc    דעפ     </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    \u05D0\u05D1\u05E6    |abc    \u05D3\u05E2\u05E4     </div>',
  '40-9 left word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ   | abc    דעפ     </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    \u05D0\u05D1\u05E6    |abc    \u05D3\u05E2\u05E4     </div>',
  '40-10 left word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ    |abc    דעפ     </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ    abc    |דעפ     </div>',
  '40-11 left word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ    a|bc    דעפ     </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ    abc    |דעפ     </div>',
  '40-12 left word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ    ab|c    דעפ     </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ    abc    |דעפ     </div>',
  '40-13 left word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ    abc|    דעפ     </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    \u05D0\u05D1\u05E6    abc    |\u05D3\u05E2\u05E4     </div>',
  '40-14 left word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ    abc |   דעפ     </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    \u05D0\u05D1\u05E6    abc    |\u05D3\u05E2\u05E4     </div>',
  '40-15 left word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ    abc  |  דעפ     </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    \u05D0\u05D1\u05E6    abc    |\u05D3\u05E2\u05E4     </div>',
  '40-16 left word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ    abc   | דעפ     </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    \u05D0\u05D1\u05E6    abc    |\u05D3\u05E2\u05E4     </div>',
  '40-17 left word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ    abc    |דעפ     </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ    abc    דעפ|     </div>',
  '40-18 left word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ    abc    ד|עפ     </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ    abc    דעפ|     </div>',
  '40-19 left word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ    abc    דע|פ     </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ    abc    דעפ|     </div>',
  '40-20 left word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ    abc    דעפ|     </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ    abc    דעפ     |</div>',
  '40-21 left word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ    abc    דעפ |    </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ    abc    דעפ     |</div>',
  '40-22 left word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ    abc    דעפ  |   </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ    abc    דעפ     |</div>',
  '40-23 left word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ    abc    דעפ   |  </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ    abc    דעפ     |</div>',
  '40-24 left word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ    abc    דעפ    | </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ    abc    דעפ     |</div>',
  '40-25 left word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ    abc    דעפ     |</div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ    abc    דעפ     |</div>',
  '40-26 left word');
</script>
